package com.spring.sunflower.main.adapter;

import android.view.View;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.spring.sunflower.R;
import com.spring.sunflower.bean.NearbyBean;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.List;

/**
 * Created by Kevin on 2021/6/2<br/>
 * <p>
 * Describe:<br/>
 */
public class NearbyAdapter extends BaseQuickAdapter<NearbyBean.DatasBean, BaseViewHolder> {
    public NearbyAdapter(int layoutResId, @Nullable List<NearbyBean.DatasBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(@NotNull BaseViewHolder baseViewHolder, NearbyBean.DatasBean datasBean) {
        Glide.with(getContext())
                .load(datasBean.getPhoto())
                .into((ImageView) baseViewHolder.getView(R.id.ivCover));
        baseViewHolder.setText(R.id.tvName, datasBean.getNickname());
        baseViewHolder.setText(R.id.tvAge, datasBean.getAge()+"岁");
        baseViewHolder.setText(R.id.tvHouse, datasBean.getCity());
        baseViewHolder.setText(R.id.tvMark, datasBean.getSignature());
        ImageView ivBeautyAuth = baseViewHolder.getView(R.id.ivBeautyAuthMark);
        ImageView ivRealAuth = baseViewHolder.getView(R.id.ivRealAuthMark);
        String liveType = datasBean.getLiveType();
        if ("-1".equals(liveType) ) {
            ivBeautyAuth.setVisibility(View.GONE);
            ivRealAuth.setVisibility(View.GONE);
        } else if ("0".equals(liveType)) {
            ivBeautyAuth.setVisibility(View.GONE);
            ivRealAuth.setVisibility(View.VISIBLE);
        } else if ("1".equals(liveType)) {
            ivBeautyAuth.setVisibility(View.VISIBLE);
            ivRealAuth.setVisibility(View.VISIBLE);
        }
    }
}
